home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln0385.arc
/
DDRIVER2.LTG
< prev
next >
Wrap
Text File
|
1986-02-27
|
2KB
|
67 lines
D Driver listing 2
IOCTL.ASM
;PERFORM IOCTL CALL FOR C MAIN PROGRAMS
;(c) Copyright 1984 by The Computer Entomologist
;
; Permission is hereby granted to use or distribute
;this software withou⌠ an∙ restrictions« Yo⌡ ma∙ includσ
;i⌠ iε an∙ hardwarσ o≥ softwarσ produc⌠ tha⌠ you sell for
;profit.
;
; This software is distributed as is, and is not
;guaranteed to work on any particular hardware/software
;configuration. Furthermore, no liability is granted with
;this software: the user takes responsibility for any
;damage this software may do to his system.
;
; If you have any questions about this software, you
;can reach me at the address below. If you implement any
;new features or find (and fix!) any bugs, I would be happy
;to hear from you.
;
; Mike Higgins
; The Computer Entomologist
; P.O. Box 197
; Duncans Mills, CA 95430
PUBLIC IOCTL ;(ASYNC,BUF,LEN,FUNC)
@CODE SEGMENT PUBLIC 'CODE'
ASSUME CS:@CODE
IOCTL PROC NEAR
;ARGUMENTS:
ASYNC=4 ;ADDRESS OF ASCIZ DEVICE NAME.
BUF=6 ;ADDRESS OF A BUFFER TO READ/WRITE FROM
LEN=8 ;THE NUMBER OF BYTES IN BUFFER
FUNC=10 ;2 FOR IOCTL READ, 3 FOR IOCTL WRITE
PUSH BP ;DO THE NORMAL C LINKAGE
MOV BP,SP
MOV DX,ASYNC[BP] ;GET NAME OF DEVICE TO OPEN
MOV AX,03D02H ;OPEN IT FOR READ/WRITE.
INT 021H ;WELL, CAN DOS DO IT?
MOV BX,AX ;STORE HANDLE IN BX
MOV DX,BUF[BP] ;GET BUFFER ADDRESS
MOV CX,LEN[BP] ;AND LENGTH.
MOV AX,FUNC[BP] ;GET FUNCTION REQUESTED,
MOV AH,68 ;TELL DOS THIS IS IOCTL CALL
INT 021H ;WAKE UP DOS.è
MOV AH,62 ;SET UP TO CLOSE HANDLE WHEN DONE
INT 021H ;ASK DOS REAL NICE.
POP BP ;RECOVER BP
RET ;RETURN TO C
IOCTL ENDP
@CODE ENDS
END